#!/bin/bash
user=$(echo $USER)
echo "当前登录用户为${user}"
currentDir=$(cd $(dirname $0); pwd)
#下载estos项目
downProject() {
    git_baseuri="http://anzhongwei:elink888@git.elinkit.com.cn:7070/r/"
    project_list=("estos-antman" "estos-collector" "estos-darkhawk" "estos-doc" "estos-for-parking"
        "estos-for-projects" "estos-heimdall" "estos-hulk" "estos-magneto" "estos-multiverse"
        "estos-quicksilver" "estos-shield" "estos-thor" "estos-util"
    )
    project_dir=/home/${user}/project/java/estos
    if [ ! -d ${project_dir} ]; then
        mkdir -p ${project_dir}
    fi
    cd ${project_dir}
    # 如果git未安装,则执行安装脚本
    if  ! command -v git > /dev/null; then
        . ${currentDir}/dev/installAndConfigGit.sh
    fi
    
    
    echo "执行克隆项目"
    for project in ${project_list[@]}; do
        cd ${project_dir}
        echo "当前操作项目："${project}
        git clone ${java_git_baseuri}${project}
        cd ${project_dir}/${project}
        git checkout -b dev
        git branch --set-upstream-to=origin/dev dev
        git pull
    done
}

# downProject
